package commonAdmin.util;

import java.lang.reflect.Field;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import sun.misc.Unsafe;

/**
 *
 *@author Jack
 *2016年2月16日下午11:38:54
 */
public class UnsafeUtil {
	private static final Logger log = LoggerFactory.getLogger(UnsafeUtil.class);

	
	public static void main(String[] args) {
		System.err.println(getUnsafe());
	}
	public static Unsafe getUnsafe() {
		
		try {
			Field theUnsafe = Unsafe.class.getDeclaredField("theUnsafe");
			theUnsafe.setAccessible(true);
			Unsafe instance = (Unsafe) theUnsafe.get(null);
			return instance;
		} catch (Exception e) {
			log.error(e.getMessage(), e);
		}
		return null;
	}

}
